/*
 * @Author: 李家磊
 * @Date: 2024-04-16 13:03:45
 * @LastEditTime: 2024-04-17 09:43:12
 * @LastEditors: lijialei
 * @Description:
 * @FilePath: /web/src/services/template/template.ts
 */
import { request } from 'umi';
import { apiUrl } from '../Common/baseInfo';

const getUrl = async(address: String) => {
  let api = await apiUrl();
  let url = `${api}${address}`;
  return url;
}

export const updateTemplate = async(data: API.Template) => {
  return await request(await getUrl('/template/update'), {
    method: 'POST',
    data: data,
  });
}

export const deleteTemplate = async(params?: any) => {
  return await request(await getUrl('/template/delete'), {
    method: 'POST',
    params
  })
}

export const pageTemplate = async(data?: API.Page) => {
  return await request(await getUrl('/template/page'), {
    method: 'POST',
    data: data,
  })
}

export const getTemplate = async(params?: any) => {
  return await request(await getUrl('/template/getById'), {
    method: 'POST',
    params
  })
}
